<?php

declare(strict_types=1);
/**
 * This file is part of Hyperf.
 *
 * @link     https://www.hyperf.io
 * @document https://doc.hyperf.io
 * @contact  group@hyperf.io
 * @license  https://github.com/hyperf-cloud/hyperf/blob/master/LICENSE
 */

namespace App\Controller;

use App\Exception\FooException;
use App\Logger\Log;
use App\Model\PhoneRegion;
use Hyperf\HttpServer\Annotation\AutoController;
use Hyperf\HttpServer\Contract\RequestInterface;
use App\JsonRpc\RpcServerInterface;
use Hyperf\RateLimit\Annotation\RateLimit;
use Hyperf\Di\Aop\ProceedingJoinPoint;
use Hyperf\Di\Annotation\Inject;
use Psr\EventDispatcher\EventDispatcherInterface;
use App\Event\UserRegistered;
use App\Request\User\FooRequest;
use Hyperf\Pool\SimplePool\PoolFactory;
use Swoole\Coroutine\Http\Client;


/**
 * @AutoController
 */
class IndexController extends AbstractController
{

    public function index(RequestInterface $request){


      // var_dump($errors);
      // return $errors->errors()->all();
      // $user = new PhoneRegion();
      // $user = $user->where('id', '>', 0)->first();
      // $this->eventDispatcher->dispatch(new UserRegistered($user));
      // return config('server');
      // $consumer = new RpcServerConsumer();
      // return $consumer->add(1, 2);

    }

    public function hello(RequestInterface $request)
    {
        var_dump($request->header('token'));

        return 'aaaaa';
    }

    public static function limitCallback(float $seconds, ProceedingJoinPoint $proceedingJoinPoint)
    {
      var_dump('limitCallback');
      // return $proceedingJoinPoint->process();
    }
}
